-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle the no-target case through user information. #408
Handle the no-target case through user information. #408
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with the changes.
I made a proposal for a simpler version (which works only if you don't need variable ZERO_TARGET
in downstream packages). If you include it, mind that I didn't run this so I am not sure I escaped correctly all the " and $.
edf0313
to
ec4a43a
Compare
Nice simplification. I just tested it, it worked as proposed. |
I let @gergondet merge if it is ok for him now. |
This looks fine, but:
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
endif() |
I thought about that too. I preferred the explicit method so that, at configure time, you explicitly say whether or not there is a targets file, rather than looking for it later. This avoids the annoying issue of a file existing but not found. If there is one but you did not find it, it is better to report an error. |
ec4a43a
to
e17035f
Compare
Last commit is correcting point 1, 2 and 3. |
package-config.cmake
Outdated
@@ -154,6 +154,13 @@ if(_PKG_CONFIG_REQUIRES) | |||
endforeach() | |||
list(REMOVE_DUPLICATES _PKG_CONFIG_REQUIRES_LIST) | |||
endif(_PKG_CONFIG_REQUIRES) | |||
|
|||
if(NOT PROJECT_EXPORT_NO_TARGET) | |||
SET(INCLUDE_TARGETS_FILE "include(\"\${CMAKE_CURRENT_LIST_DIR}/${TARGETS_EXPORT_NAME}.cmake\")") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-set+SET (same below)
I agree on point 4 as well. So just two more small changes and it's good too go :) |
Lean implementation. Uses variable PROJECT_EXPORT_NO_TARGET Documentation for the variable. From SET to set
e17035f
to
275ad54
Compare
SET -> set done |
Goal
Handling package with no targets (typically data packages)
Issue #398
Remplacement of PR #403
Principle
The user specifies the property/variable ZERO_TARGET of the target PROJECT_NAME to true:
Then the export of exportTarget.cmake is not generated (currently generating a bug),
and then an expression is set on Config.cmake.in avoiding the inclusion of this file.
This is necessary to avoid later error when upstream packages are using the cmake recipe of this package.
When a normal package is used the expression is true and thus the inclusion of the target is done.
Tested in both situations.